﻿namespace ACCOUNTING.LVY.Business
{
    using ACCOUNTING;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Data;
    using System.Windows.Forms;

    public class clsKiemKeHangHoaChiTiet
    {
        private string mHanSuDung = "";
        private string mKhoaHangHoa = "";
        private string mKhoaKho = "";
        private string mKhoaKiemKe = "";
        private string mKhoaQuayKe = "";
        private string mNgayNhap = "";
        private string mSoLoHang = "";
        private double mSoLuongChenhLech = 0.0;
        private double mSoLuongKiemKe = 0.0;
        private double mSoLuongTon = 0.0;
        private string mSoSeri = "";
        private decimal mTriGiaTon = new decimal();

        public bool Save()
        {
            IDataParameter[] commandParameters = new IDataParameter[13];
            try
            {
                commandParameters[0] = DBHelper.createParameter("@KhoaKiemKe", DbType.Int16, ParameterDirection.Input, this.mKhoaKiemKe);
                commandParameters[1] = DBHelper.createParameter("@KhoaKho", DbType.Int16, ParameterDirection.Input, this.mKhoaKho);
                commandParameters[2] = DBHelper.createParameter("@KhoaHangHoa", DbType.Int16, ParameterDirection.Input, this.mKhoaHangHoa);
                commandParameters[3] = DBHelper.createParameter("@KhoaQuayKe", DbType.Int16, ParameterDirection.Input, this.mKhoaQuayKe);
                commandParameters[4] = DBHelper.createParameter("@SoLoHang", DbType.Int16, ParameterDirection.Input, this.mSoLoHang);
                commandParameters[5] = DBHelper.createParameter("@SoSeri", DbType.Int16, ParameterDirection.Input, this.mSoSeri);
                commandParameters[6] = DBHelper.createParameter("@NgayNhap", DbType.Int16, ParameterDirection.Input, this.mNgayNhap);
                commandParameters[7] = DBHelper.createParameter("@HanSuDung", DbType.Int16, ParameterDirection.Input, this.mHanSuDung);
                commandParameters[8] = DBHelper.createParameter("@SoLuongTon", DbType.Date, ParameterDirection.Input, this.mSoLuongTon);
                commandParameters[9] = DBHelper.createParameter("@TriGiaTon", DbType.Date, ParameterDirection.Input, this.mTriGiaTon);
                commandParameters[10] = DBHelper.createParameter("@SoLuongKiemKe", DbType.Date, ParameterDirection.Input, this.mSoLuongKiemKe);
                commandParameters[11] = DBHelper.createParameter("@SoLuongChenhLech", DbType.Date, ParameterDirection.Input, this.mSoLuongChenhLech);
                commandParameters[12] = DBHelper.createParameter("@pError", DbType.Double, ParameterDirection.Output, 0);
                DBHelper.ExecuteNonQuery(modGeneral.ConnectionString, CommandType.StoredProcedure, "ST_sp_KiemKeHangHoaChiTiet", commandParameters);
                if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(commandParameters[12].Value, 0, false))
                {
                    return false;
                }
                return true;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                bool flag = false;
                ProjectData.ClearProjectError();
                return flag;
                ProjectData.ClearProjectError();
            }
            return false;
        }

        public string HanSuDung
        {
            get
            {
                return this.mHanSuDung;
            }
            set
            {
                this.mHanSuDung = value;
            }
        }

        public string KhoaHangHoa
        {
            get
            {
                return this.mKhoaHangHoa;
            }
            set
            {
                this.mKhoaHangHoa = value;
            }
        }

        public string KhoaKho
        {
            get
            {
                return this.mKhoaKho;
            }
            set
            {
                this.mKhoaKho = value;
            }
        }

        public string KhoaKiemKe
        {
            get
            {
                return this.mKhoaKiemKe;
            }
            set
            {
                this.mKhoaKiemKe = value;
            }
        }

        public string KhoaQuayKe
        {
            get
            {
                return this.mKhoaQuayKe;
            }
            set
            {
                this.mKhoaQuayKe = value;
            }
        }

        public string NgayNhap
        {
            get
            {
                return this.mNgayNhap;
            }
            set
            {
                this.mNgayNhap = value;
            }
        }

        public string SoLoHang
        {
            get
            {
                return this.mSoLoHang;
            }
            set
            {
                this.mSoLoHang = value;
            }
        }

        public string SoLuongChenhLech
        {
            get
            {
                return Conversions.ToString(this.mSoLuongChenhLech);
            }
            set
            {
                this.mSoLuongChenhLech = Conversions.ToDouble(value);
            }
        }

        public string SoLuongKiemKe
        {
            get
            {
                return Conversions.ToString(this.mSoLuongKiemKe);
            }
            set
            {
                this.mSoLuongKiemKe = Conversions.ToDouble(value);
            }
        }

        public string SoLuongTon
        {
            get
            {
                return Conversions.ToString(this.mSoLuongTon);
            }
            set
            {
                this.mSoLuongTon = Conversions.ToDouble(value);
            }
        }

        public string SoSeri
        {
            get
            {
                return this.mSoSeri;
            }
            set
            {
                this.mSoSeri = value;
            }
        }

        public string TriGiaTon
        {
            get
            {
                return Conversions.ToString(this.mTriGiaTon);
            }
            set
            {
                this.mTriGiaTon = Conversions.ToDecimal(value);
            }
        }
    }
}

